﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NETMovie.UI.WebMVC.Models.MovieViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Search
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Search</h2>

    <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script>
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script>
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>" type="text/javascript"></script>
    <script src="<%= Url.Content("~/Scripts/jquery-1.3.2.js") %>" type="text/javascript"></script>

  
    <% using (Ajax.BeginForm("Search", new AjaxOptions { UpdateTargetId = "SearchResult" }))
      //using (Html.BeginForm())
        { %>

    <fieldset>
     <div id="SearchByCategory">
        <%= Html.LabelFor(m => m.Category)%>
        <%: Html.DropDownListFor(m => m.Category, Model.Categories ,"-----select one--")%>
       <%= Html.DropDownListFor(m => m.Category, (SelectList)Session["Category"], "--select one--")%>
       
     
     
       </div>

        <div id="SearchByCastMember">
            <%= Html.LabelFor(m => m.CastMember)%>
           <%= Html.DropDownListFor(m => m.CastMember, Model.CastMembers , "--select one--")%>
           <%= Html.DropDownListFor(m => m.CastMember, (SelectList)Session["CastMember"], "--select one--")%>
        </div>

        <p>
            <input type="submit" name="SearchButton" value="Search" />
        </p>

    </fieldset>

        <div id="SearchResult">
            <%if (Model.Result != null && Model.Result.Count()>0)
              {
                  Html.RenderPartial("SearchResult", Model.Result);
              }%>
        </div>

    <%} %>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#From").change(function () {
                var selection = $("#From").val();
                $("#SearchTo").load("/Flight/DestinationList/" + selection);
            });
        });
    </script>
</asp:Content>